from driver import PWM
import utime


#设置pwm1
def start_pwm1(a,b):
    param = {'freq':a, 'duty': b }  #频率/占空比
    pwm1.setOption(param)

#设置pwm0
def start_pwm0(a,b):
    param2 = {'freq':a, 'duty': b }  #频率/占空比
    pwm0.setOption(param2)

if __name__=='__main__':
    pwm0 = PWM()
    pwm1 = PWM()
    pwm1.open("pwm1")
    pwm0.open("pwm0")
    start_pwm1(5000,50)
    start_pwm0(5000,50)

    utime.sleep(10)

    #获取当前pwm频率和占空比
    ret = pwm1.getOption()
    print("pwm1.getOption={}".format(ret))
    ret = pwm0.getOption()
    print("pwm0.getOption={}".format(ret))
    # pwm1.close()
    # pwm0.close()
    while True:
        utime.sleep(1)